package jyj.springmvc.learning.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

/**
 * @Author 老顽固小可爱
 * @Date 2022/12/11 22:06
 * @Version 1.0
 */
@Controller
public class ParamController {
    @RequestMapping("/")
    public String sayHello() {
        return "index";
    }

    /**
     * 通过 HttpServletRequest 获取请求参数
     *
     * @param request
     * @return
     */
    @RequestMapping("/getRequestParam")
    public String requestParam(HttpServletRequest request) {
        String name = request.getParameter("name");
        String url = request.getParameter("url");
        System.out.println("name:" + name);
        System.out.println("url:" + url);
        return "index";
    }
}
